#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 100005;
int a[N], ans;
void binary_search (int l, int r, int val) {
	if (l == r) {
		if (a[l] == val) {
			ans++;
		}
		return;
	}
	int mid = (l + r) / 2;
	if (a[mid] < val) {
		binary_search (mid + 1, r, val);
	} else {
		binary_search (l, mid, val);
	}
}
int main() {
	while (1) {
		int cnt = 0;
		ans = 0;
		int x;
		memset (a, 0, sizeof(a));
		while (++cnt) {	
			scanf ("%d", &x);
			if (x == 0) {
				break;
			}
			if (x == -1) {
				return 0;
			}
			a[cnt] = x;
		}
		sort (a + 1, a + cnt + 1);
		for (int i = 1; i <= cnt; i++) {
			x = a[i] * 2;
			binary_search(1, cnt, x);
		}
		printf ("%d\n", ans);
	}
	return 0;
}
